for termlib in ncurses curses termcap terminfo termlib; do
echo $ac_n "checking for tputs in -l${termlib}""... $ac_c" 1>&6
echo "configure:3569: checking for tputs in -l${termlib}" >&5
ac_lib_var=`echo ${termlib}'_'tputs | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
ac_save_LIBS="$LIBS"
LIBS="-l${termlib} $LIBS"
cat > conftest.$ac_ext <<EOF
#line 3577 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
builtin and then its argument prototype would still apply. */
char tputs();
int main() {
tputs()
; return 0; }
EOF
if { (eval echo configure:3588: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=no"
fi
rm -f conftest*
LIBS="$ac_save_LIBS"
fi
if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
echo "$ac_t""yes" 1>&6
gp_tcap="${gp_tcap} -l${termlib}"
else
echo "$ac_t""no" 1>&6
fi
case "${gp_tcap}" in
*-l${termlib}*)
echo "$ac_t""using ${gp_tcap} with readline" 1>&6
break
;;
esac
done
if test "$with_gnu_readline" = yes; then
echo $ac_n "checking for readline in -lreadline""... $ac_c" 1>&6
echo "configure:3618: checking for readline in -lreadline" >&5
ac_lib_var=`echo readline'_'readline | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
ac_save_LIBS="$LIBS"
LIBS="-lreadline ${gp_tcap} $LIBS"
cat > conftest.$ac_ext <<EOF
#line 3626 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
builtin and then its argument prototype would still apply. */
char readline();
int main() {
readline()
; return 0; }
EOF
if { (eval echo configure:3637: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=no"
fi
rm -f conftest*
LIBS="$ac_save_LIBS"
fi
if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
echo "$ac_t""yes" 1>&6
LIBS="$LIBS -lreadline $gp_tcap"
cat >> confdefs.h <<\EOF
#define GNU_READLINE 1
EOF
with_readline=no
else
echo "$ac_t""no" 1>&6
{ echo "configure: error: Can't find -lreadline in a standard path -- specify its location using --with-gnu-readline=/path/to/libreadline.a" 1>&2; exit 1; }
fi
else
if test ! -f $with_gnu_readline ; then
if test ! -f ${with_gnu_readline}/lib/libreadline.a ; then
if test ! -f ${with_gnu_readline}/libreadline.a ; then
{ echo "configure: error: GNU readline library not found" 1>&2; exit 1; }